import regeneratorRuntime from "../../vendor/regenerator-runtime/runtime";
import { GHHttp } from "../http/fetch";
import file from "../../cache/gh-file";
import config from "../url.config";
import GlobalConfig from '../../config/index';
const Domain = GlobalConfig.Domain;
const ApiPath = GlobalConfig.ApiPath;
const FilePath = GlobalConfig.FilePath;
function GhUploadImg(opts) {
  let options = {
    ...opts,
    url: config.uploadImg
  };
  console.log(options)
  async function getBase64() {
    let data = await file.read(opts.filePath, 'base64');
    return data.data
  }

  getBase64(options).then((imgString) => {
    // data:image/png;base64
    let { key, name, url } = options;
    let data = {};
    data[name] = imgString;

    GHHttp({
      key,
      data,
    })
  });

}
export { GhUploadImg }